<?php

@error_reporting(4095);
@date_default_timezone_set('PRC');
@set_time_limit(0);
@ini_set('register_globals', false);
@ini_set("magic_quotes_runtime", 0);
@ini_set("magic_quotes_sybase", 0);

$thefile = explode('/',$_SERVER['PHP_SELF']);
$thefile = end($thefile);

$iswml = isset($_SERVER['HTTP_ACCEPT']) ? '.'.strtolower($_SERVER['HTTP_ACCEPT']) : false;
if ( $iswml && (
strpos($iswml,'text/html') ||
strpos($iswml,'application/xhtml+xml')
)){
$iswml= false;
define('hr','<hr/>');
}else{
$iswml = isset($_SERVER['HTTP_USER_AGENT']) ? '.'.$_SERVER['HTTP_USER_AGENT'] : false;
if (
$iswml && (
stripos($iswml,'MSIE') ||
stripos($iswml,'Windows') ||
stripos($iswml,'Mozilla') ||
stripos($iswml,'Symbian') ||
stripos($iswml,'iPhone') ||
stripos($iswml,'KHTML') ||
stripos($iswml,'Chrome') ||
stripos($iswml,'ucweb') ||
stripos($iswml,'smartphone') ||
stripos($iswml,'blackberry') ||
stripos($iswml,'opera') ||
stripos($iswml,'AppleWebKit')
)){
$iswml= false;
define('hr','<hr/>');
}else{
$iswml= true;
define('hr','<br/>------------<br/>');
}
}

function top($title){
global $iswml;
if ( $iswml ){
header('Content-Type: text/vnd.wap.wml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml><head><meta http-equiv="Cache-Control" content="max-age=0"/>
<meta http-equiv="Cache-Control" content="no-cache"/></head>
<card id="main" title="'.$title.'">
<p>';
}else{
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8"/>
<meta http-equiv="Cache-Control" content="must-revalidate,no-cache"/>
<title>'.$title.'</title>
</head><body>';
}
}
function foot(){
global $iswml;
hr();
echo '<b>胜永网<a style="color:red" href="http://awby.cn">Http://Awby.cn</a></b>';
if ( $iswml ){
echo '</p></card></wml>';
}else{
echo '</body></html>';
}
exit;
}
function hr(){
global $iswml;
if ( $iswml ){
echo '<br/>------------<br/>';
}else{
echo '<hr/>';
}
}
$cmd = isset($_GET['cmd']) ? $_GET['cmd'] : NULL;
top('自动安装程序');


$data = @file_get_contents('http://zheli.org/data/f_78627977.zip');
if ( !$data ){
echo '远程获取pclzip失败,请刷新本页,如果本信息依旧出现,请确认服务器开启了远程访问HTTP的功能(file_get_contents)。';
}elseif ( !@file_put_contents('pclzip.lib.php',$data) ){
echo '保存pclzip失败,请刷新本页,如果本信息依旧出现,请确认本程序有写入权限。';
}else{
if ( !$data = @file_get_contents('http://zheli.org/data/f_14501946.zip')  ){
echo '获取new_awby.zip源码失败,请刷新本页,如果本信息依旧出现,请确认服务器开启了远程访问HTTP的功能(file_get_contents)。';
}elseif ( !@file_put_contents('data.zip',$data) ){
echo '保存源码,请刷新本页,如果本信息依旧出现,请确认本程序有写入权限。';
}else{
if ( !@include('pclzip.lib.php') ){
echo 'pclzip组件丢失,<a href="'.$thefile.'?cmd=step1">返回第一步</a><br/>';
}elseif ( !file_exists('data.zip') ) {
echo 'new_awby.zip源码丢失,<a href="'.$thefile.'?cmd=step2">返回第二步</a><br/>';
}else{
$archive = new PclZip('data.zip');
if( $archive->extract(PCLZIP_OPT_PATH,$_SERVER['DOCUMENT_ROOT'],PCLZIP_OPT_REPLACE_NEWER) ){
echo '解压缩成功,<a href="/install/">进入程序安装配置</a><br/>';
echo '感谢您使用！本程序完全免费,最后一步为在线安装,安装完成后请务必删除本文件！！<br/>';
@unlink('data.zip');
@unlink('pclzip.lib.php');
}else{
echo '解压缩失败,请刷新本页,如果本信息依旧出现,请确认本程序有写入权限。';
}
}
}
}


foot();
?>